import api from "./init";
import {AxiosResponse} from "axios";
import {Result} from "@/types/api-common";
import {FileUploadResponse} from "@/types/file-upload";

/**
 * 上传文件到服务器
 * @param formData
 */
export const uploadFileApi = async (formData: FormData) : Promise<AxiosResponse<Result<FileUploadResponse>>> => {
    return api.post("/file/upload",
        formData,
        {
            headers: {
                "Content-Type": "multipart/form-data",
            },
        })
}